function updateMenus(isBookOpen)
{	
	var close, play, stop, prevphrase, nextphrase;
    close = document.getElementById("closebook-cmd");
	play = document.getElementById("play-cmd");
	stop = document.getElementById("stop-cmd");
	prevphrase = document.getElementById("prevphrase-cmd");
	nextphrase = document.getElementById("nextphrase-cmd");
	sidebar = document.getElementById("togglesidebar-cmd");
	
	if (isBookOpen)
	{
        if (close) close.setAttribute("disabled", "false");
		if (sidebar) sidebar.setAttribute("disabled", "false");
		if (play) play.setAttribute("disabled", "false");
		if (prevphrase) prevphrase.setAttribute("disabled", "false");
		if (nextphrase) nextphrase.setAttribute("disabled", "false");
	}
	else
	{
        if (close) close.setAttribute("disabled", "true");
		if (sidebar) sidebar.setAttribute("disabled", "true");
		if (play) play.setAttribute("disabled", "true");
		if (prevphrase) prevphrase.setAttribute("disabled", "true");
		if (nextphrase) nextphrase.setAttribute("disabled", "true");
	}
    if (stop) stop.setAttribute("disabled", "true");
}

// Called after playback has stopped
function updateMenusStopped()
{
    document.getElementById("play-cmd").setAttribute("disabled", "false");
    document.getElementById("stop-cmd").setAttribute("disabled", "true");
    document.getElementById("play-stop-key").setAttribute("command", "play-cmd");
}

function updateMenusPlaying()
{
    document.getElementById("play-cmd").setAttribute("disabled", "true");
    document.getElementById("stop-cmd").setAttribute("disabled", "false");
    document.getElementById("play-stop-key").setAttribute("command", "stop-cmd");
}
